<%@ page contentType="text/html; charset=utf-8" language="java"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="thx" uri="/thx-tags"%>
<%@ taglib prefix="fun" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt"%>


<section class="content">
	<div class="row">
		<div class="col-md-12">
			<div class="box-header with-border">
				<div class="row">
					<form class="search-panel" action="addressbook/addressbookGroup!list.action" name="search-form" result-container=".right">
						<input type="hidden" name="pid" value="${pid}">
						<input type="text" class="form-control" placeholder="请输入分组名称" name="searchGroupName" value="${searchGroupName}">
						<button type="button" class="btn btn-primary search-btn">搜索</button>
					</form>
				</div>
			</div>
			<div class="box-body no-padding">
				<div class="row">
					<div class="col-sm-12">
						<table class="table table-bordered">
							<tr>
								<th>通讯分组</th>
								<th>操作</th>
							</tr>
							<c:if test="${empty list}">
								<tr>
									<td colspan="2">暂无数据！</td>
								</tr>
							</c:if>
							<c:forEach items="${list}" var="e">
								<tr>
									<td><a href="#" class="addressbookgroup-enterBut" data-id="${e.agId}">${e.agName}</a></td>
									<td>
										<button type="button"
											title="修改"
											data-toggle="tooltip"
											data-placement="bottom"
											open-url="addressbook/addressbookGroup!input.action?pid=${pid}&id=${e.agId}"
											class="btn btn-default btn-sm btn-open-form">
											<i class="fa fa-edit"></i>
										</button>
										<button type="button"
											title="删除"
											data-toggle="tooltip"
											data-placement="bottom"
											do-url="addressbook/addressbookGroup!delete.action?pid=${pid}&id=${e.agId}"
											load-url="addressbook/addressbookCategory!category.action" load-container=".content-wrapper"
											confirm-msg="确定要删除吗？"
											class="btn btn-default btn-sm btn-open-confirm-win">
											<i class="fa fa-trash"></i>
										</button>
									</td>
								</tr>
							</c:forEach>
						</table>
					</div>
				</div>
			</div>
			<div class="box-footer">
				<!--分页区-->
				<div class="pagePanel">
					<thx:pages pageNo="page.curPage" total="page.totalPage" theme="number">
						<s:param name="searchGroupName" value="searchGroupName"></s:param>
					</thx:pages>
				</div>
				<!--底部操作区-->
				<div class="handlePanel">
					<a title="新增分组" open-url="addressbook/addressbookGroup!input.action?pid=${pid}"
						class="a-btn btn-open-form"> <span class="fa fa-plus"></span>
						<span class="text">新增</span>
					</a>
				</div>
			</div>
		</div>
	</div>
</section>
<script>
	require([ 'list','util', 'thx-page'], function(list,util, page) {
		list.init();
		page.init(".right");
		var ctxPath = "${pageContext.request.contextPath}";
		$(".addressbookgroup-enterBut").click(
			function() {
				var data_id = $(this).attr("data-id");
				var href = ctxPath
						+ '/addressbook/addressbook!list.action?pid='+data_id;
				util.ajaxPage(href,'',true,'div.right');
		});
	});
</script>
